package com.seadragon.app.ksr.loader;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.seadragon.app.ksr.dao.CategoryDao;
import com.seadragon.app.ksr.model.Category;
import com.seadragon.app.ksr.model.CategoryPriceCategorization;

@Component("categoryLoader")
public class CategoryLoader {

	private static Logger logger = LoggerFactory.getLogger(CategoryLoader.class);
	@Autowired
	private CategoryDao categoryDao;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if(args == null || args.length == 0){
			logger.error("Usage: CategoryLoader");
			return;
		}
		 ApplicationContext appCtx = new ClassPathXmlApplicationContext("ksr-application-context-sa-postgres.xml");
		CategoryLoader loader = (CategoryLoader)appCtx.getBean("categoryLoader");
		for(String s : args){
			if(s.equalsIgnoreCase("-l")){
				loader.load();
			}else if(s.equalsIgnoreCase("-a")){
				loader.addMore();
			}else if(s.equalsIgnoreCase("-u")){
				loader.update();
			}
		}
		 ((AbstractApplicationContext)appCtx).close();
	}

	@Transactional
	public void load() {
		Category sports = new Category();
		sports.setParent(null);
		sports.setName("Sports");
		sports.setLevel(1);
		sports.setDescription("Sport is generally recognised as activities based in physical athleticism or physical dexterity");
		Category basketball = new Category();
		sports.getChildren().add(basketball);
		basketball.setParent(sports);
		basketball.setName("Basketball");
		basketball.setLevel(2);
		basketball.setDescription("Basketball is a sport played by two teams of five players on a rectangular court. The objective is to shoot a ball through a hoop 18 inches (46 cm) in diameter and 10 feet (3.0 m) high mounted to a backboard at each end.");
		Category baseball = new Category();
		sports.getChildren().add(baseball);
		baseball.setParent(sports);
		baseball.setName("Baseball");
		baseball.setLevel(2);
		baseball.setDescription("Baseball is a bat-and-ball game played between two teams of nine players who take turns batting and baserunning. The offense attempts to score more runs than its opponents by hitting a ball thrown by the pitcher with a bat and moving counter-clockwise around a series of four bases: first, second, third and home plate. A run is scored when the runner advances around the bases and returns to home plate.");
		Category soccer = new Category();
		sports.getChildren().add(soccer);
		soccer.setParent(sports);
		soccer.setName("Soccer");
		soccer.setLevel(2);
		soccer.setDescription("Soccer is a sport played between two teams of eleven players with a spherical ball, The game is played on a rectangular field with a goal at each end. The object of the game is to score by kicking the ball into the opposing goal.");
		Category football = new Category();
		sports.getChildren().add(football);
		football.setParent(sports);
		football.setName("Football");
		football.setLevel(2);
		football.setDescription("American football, known in the United States as football, is a sport played by two teams of eleven players on a rectangular field 120 yards long by 53.3 yards wide with goalposts at each end. The offense attempts to advance an oval ball[2] down the field by running with or passing it. They must advance it at least ten yards in four downs to receive a new set of four downs and continue the drive; if not, they turn over the ball to the opposing team. Points are scored by advancing the ball into the end zone for a touchdown, kicking the ball through the opponent's goalposts for a field goal or by the defense tackling the ball carrier in the offense's end zone for a safety.");
		Category volleyball = new Category();
		sports.getChildren().add(volleyball);
		volleyball.setParent(sports);
		volleyball.setName("Volleyball");
		volleyball.setLevel(2);
		volleyball.setDescription("Volleyball is a team sport in which two teams of six players are separated by a net. Each team tries to score points by grounding a ball on the other team's court under organized rules.");
		Category hockey = new Category();
		sports.getChildren().add(hockey);
		hockey.setParent(sports);
		hockey.setName("Hockey");
		hockey.setLevel(2);
		hockey.setDescription("Hockey is a family of sports in which two teams play against each other by trying to maneuver a ball or a puck into the opponent's goal using a hockey stick.");
		Category tennis = new Category();
		sports.getChildren().add(tennis);
		tennis.setParent(sports);
		tennis.setName("Tennis");
		tennis.setLevel(2);
		tennis.setDescription("Tennis is a sport usually played between two players (singles) or between two teams of two players each (doubles). Each player uses a racquet that is strung with cord to strike a hollow rubber ball covered with felt over or around a net and into the opponent's court. The object of the game is to play the ball in such a way that the opponent is not able to play a good return.");
		Category pingPong = new Category();
		sports.getChildren().add(pingPong);
		pingPong.setParent(sports);
		pingPong.setName("Ping Pong");
		pingPong.setLevel(2);
		pingPong.setDescription("Table tennis is a sport in which two or four players hit a lightweight ball back and forth using table tennis rackets. The game takes place on a hard table divided by a net. Except for the initial serve, players must allow a ball played toward them only one bounce on their side of the table and must return it so that it bounces on the opposite side. Points are scored when a player fails to return the ball within the rules. Play is fast and demands quick reactions. Spinning the ball alters its trajectory and limits an opponent's options, giving the hitter a great advantage. When doing so the hitter has a good chance of scoring if the spin is successful.");
		Category badminton = new Category();
		sports.getChildren().add(badminton);
		badminton.setParent(sports);
		badminton.setName("Badminton");
		badminton.setLevel(2);
		badminton.setDescription("Badminton is a racquet sport played by either two opposing players (singles) or two opposing pairs (doubles), who take positions on opposite halves of a rectangular court divided by a net. Players score points by striking a shuttlecock with their racquet so that it passes over the net and lands in their opponents' half of the court. Each side may only strike the shuttlecock once before it passes over the net. A rally ends once the shuttlecock has struck the floor, or if a fault has been called by either the umpire or service judge or, in their absence, the offending player, at any time during the rally.");
		Category karate = new Category();
		sports.getChildren().add(karate);
		karate.setParent(sports);
		karate.setName("Karate");
		karate.setLevel(2);
		karate.setDescription("Karate is a striking art using punching, kicking, knee strikes, elbow strikes and open hand techniques such as knife-hands, spear-hands,and palm-heel strikes. In some styles, grappling, throws, joint locks, restraints, and vital point strikes are also taught.");
		Category taekwondo = new Category();
		sports.getChildren().add(taekwondo);
		taekwondo.setParent(sports);
		taekwondo.setName("Taekwondo");
		taekwondo.setLevel(2);
		taekwondo.setDescription("Taekwondo is a martial art originating in Korea. It combines combat and self-defense techniques with sport and exercise.");
		Category skiing = new Category();
		sports.getChildren().add(skiing);
		skiing.setParent(sports);
		skiing.setName("Skiing");
		skiing.setLevel(2);
		skiing.setDescription("Skiing is a recreational activity and competitive sport in which the participant attaches long runners or skis to boots or shoes on the feet and uses them to travel on top of snow. ");
		Category skating = new Category();
		sports.getChildren().add(skating);
		skating.setParent(sports);
		skating.setName("Skating");
		skating.setLevel(2);
		skating.setDescription("Skating involves any sports or recreational activity which consists of traveling on surfaces or on ice using skates.");
		Category martialArts = new Category();
		sports.getChildren().add(martialArts);
		martialArts.setParent(sports);
		martialArts.setName("Martial Arts");
		martialArts.setLevel(2);
		martialArts.setDescription("Martial arts are codified systems and traditions of combat practices, which are practiced for a variety of reasons: self-defense, competition, physical health and fitness, entertainment, as well as mental, physical, and spiritual development.");
		Category boxing = new Category();
		sports.getChildren().add(boxing);
		boxing.setParent(sports);
		boxing.setName("Boxing");
		boxing.setLevel(2);
		boxing.setDescription("Boxing is a combat sport in which two people engage in a contest of strength, speed, reflexes, endurance, and will by throwing punches with gloved hands against another opponent.");
		Category surfing = new Category();
		sports.getChildren().add(surfing);
		surfing.setParent(sports);
		surfing.setName("Surfing");
		surfing.setLevel(2);
		surfing.setDescription("Surfing is a surface water sport in which the wave rider, referred to as a \"surfer\", rides on the forward face of a moving wave which is usually carrying the surfer towards the shore");
		Category golf = new Category();
		sports.getChildren().add(golf);
		golf.setParent(sports);
		golf.setName("Golf");
		golf.setLevel(2);
		golf.setDescription("Golf is a precision club and ball sport in which competing players (or golfers) use many types of clubs to hit balls into a series of holes on a course using the fewest number of strokes. Golf is defined, in the rules of golf, as \"playing a ball with a club from the teeing ground into the hole by a stroke or successive strokes in accordance with the Rules.\"");
		Category gymnastics = new Category();
		sports.getChildren().add(gymnastics);
		gymnastics.setParent(sports);
		gymnastics.setName("Gymnastics");
		gymnastics.setLevel(2);
		gymnastics.setDescription("Gymnastics is a sport involving the performance of exercises requiring physical strength, flexibility, power, agility, coordination, and balance.");
		Category equitation = new Category();
		sports.getChildren().add(equitation);
		equitation.setParent(sports);
		equitation.setName("Equitation");
		equitation.setLevel(2);
		equitation.setDescription("Equitation is the art or practice of horse riding or horsemanship.");
		Category bowling = new Category();
		sports.getChildren().add(bowling);
		bowling.setParent(sports);
		bowling.setName("Bowling");
		bowling.setLevel(2);
		bowling.setDescription("Bowling refers to a series of sports or leisure activities in which a player rolls or throws a bowling ball.");
		Category billards = new Category();
		sports.getChildren().add(billards);
		billards.setParent(sports);
		billards.setName("Billards");
		billards.setLevel(2);
		billards.setDescription("Cue sports, also known as billiard sports,[1][2] are a wide variety of games of skill generally played with a cue stick which is used to strike billiard balls, moving them around a cloth-covered billiards table bounded by rubber cushions.");
		Category archery = new Category();
		sports.getChildren().add(archery);
		archery.setParent(sports);
		archery.setName("Archery");
		archery.setLevel(2);
		archery.setDescription("Archery is the art, practice, or skill of propelling arrows with the use of a bow, from Latin arcus.");
		Category kendo = new Category();
		sports.getChildren().add(kendo);
		kendo.setParent(sports);
		kendo.setName("Kendo");
		kendo.setLevel(2);
		kendo.setDescription("Kendo is a physically and mentally challenging activity that combines martial arts practices and values with sport-like strenuous physical activity.");
		Category judo = new Category();
		sports.getChildren().add(judo);
		judo.setParent(sports);
		judo.setName("Judo");
		judo.setLevel(2);
		judo.setDescription("Judo is a modern martial art, combat and Olympic sport created in Japan in 1882 by Jigoro Kano(鍢夌磵娌讳簲閮�. Its most prominent feature is its competitive element, where the objective is to either throw or takedown an opponent to the ground, immobilize or otherwise subdue an opponent with a pin, or force an opponent to submit with a joint lock or a choke. Strikes and thrusts by hands and feet as well as weapons defenses are a part of judo, but only in pre-arranged forms and are not allowed in judo competition or free practice.");
		Category jujutsu = new Category();
		sports.getChildren().add(jujutsu);
		jujutsu.setParent(sports);
		jujutsu.setName("Jujutsu");
		jujutsu.setLevel(2);
		jujutsu.setDescription("Jujutsu is a Japanese martial art and a method of close combat for defeating an armed and armored opponent in which one uses no weapon or only a short weapon.");
		Category wrestling = new Category();
		sports.getChildren().add(wrestling);
		wrestling.setParent(sports);
		wrestling.setName("Wrestling");
		wrestling.setLevel(2);
		wrestling.setDescription("Wrestling is a form of combat sport involving grappling type techniques such as clinch fighting, throws and takedowns, joint locks, pins and other grappling holds.");
		Category yoga = new Category();
		sports.getChildren().add(yoga);
		yoga.setParent(sports);
		yoga.setName("Yoga");
		yoga.setLevel(2);
		yoga.setDescription("Yoga is a commonly known generic term for the physical, mental, and spiritual practices or disciplines which originated in ancient India with a view to attain a state of permanent peace.");
		Category canoeing = new Category();
		sports.getChildren().add(canoeing);
		canoeing.setParent(sports);
		canoeing.setName("Canoeing");
		canoeing.setLevel(2);
		canoeing.setDescription("Canoeing is a paddle sport in which you kneel or sit facing forward in an open-decked canoe, and propel yourself with a single-bladed paddle, under your own power.");
		Category kayaking = new Category();
		sports.getChildren().add(kayaking);
		kayaking.setParent(sports);
		kayaking.setName("Kayaking");
		kayaking.setLevel(2);
		kayaking.setDescription("Kayaking is the use of a Kayak for moving across water.");
		Category rafting = new Category();
		sports.getChildren().add(rafting);
		rafting.setParent(sports);
		rafting.setName("Rafting");
		rafting.setLevel(2);
		rafting.setDescription("Rafting or white water rafting is the challenging recreational outdoor activity of using an inflatable raft to navigate a river or other bodies of water. This is usually done on white water or different degrees of rough water, in order to thrill and excite the raft passengers.");
		Category swimming = new Category();
		sports.getChildren().add(swimming);
		swimming.setParent(sports);
		swimming.setName("Swimming");
		swimming.setLevel(2);
		swimming.setDescription("Human swimming is the self propulsion of a person through water or other liquid, for survival, recreation, sport, exercise or other reason.");
		Category diving = new Category();
		sports.getChildren().add(diving);
		diving.setParent(sports);
		diving.setName("Diving");
		diving.setLevel(2);
		diving.setDescription("Diving is the sport of jumping or falling into water from a platform or springboard, sometimes while performing acrobatics.");
		Category draughts = new Category();
		sports.getChildren().add(draughts);
		draughts.setParent(sports);
		draughts.setName("Draughts");
		draughts.setLevel(2);
		draughts.setDescription("Draughts is a group of strategy board games for two players which involve diagonal moves of uniform game pieces and mandatory captures by jumping over opponent pieces.");
		Category chess = new Category();
		sports.getChildren().add(chess);
		chess.setParent(sports);
		chess.setName("Chess");
		chess.setLevel(2);
		chess.setDescription("Chess is a two-player strategy board game played on a chessboard, a checkered gameboard with 64 squares arranged in an eight-by-eight grid.Each player begins the game with 16 pieces: one king, one queen, two rooks, two knights, two bishops, and eight pawns. Each of the six piece types moves differently. Pieces are used to attack and capture the opponent's pieces, with the objective to 'checkmate' the opponent's king by placing it under an inescapable threat of capture. In addition to checkmate, the game can be won by the voluntary resignation of the opponent, which typically occurs when too much material is lost, or if checkmate appears unavoidable. A game may also result in a draw in several ways, where neither player wins.");
		Category chineseChess = new Category();
		sports.getChildren().add(chineseChess);
		chineseChess.setParent(sports);
		chineseChess.setName("Chinese Chess");
		chineseChess.setLevel(2);
		chineseChess.setDescription("Chinese chess is a strategy board game for two players, the game represents a battle between two armies, with the object of capturing the enemy's general (king). Distinctive features of xiangqi include the cannon (pao), which must jump to capture; a rule prohibiting the generals from facing each other directly; areas on the board called the river and palace, which restrict the movement of some pieces (but enhance that of others); and placement of the pieces on the intersections of the board lines, rather than within the squares.");
		Category chineseCheckers = new Category();
		sports.getChildren().add(chineseCheckers);
		chineseCheckers.setParent(sports);
		chineseCheckers.setName("Chinese Checkers");
		chineseCheckers.setLevel(2);
		chineseCheckers.setDescription("Chinese checkers is a strategy board game which can be played by two, three, four, or six people, playing individually or with partners.");
		
		Category arts = new Category();
		arts.setParent(null);
		arts.setName("Arts");
		arts.setLevel(1);
		arts.setDescription("Art is a diverse range of human activities and the products of those activities");
		Category visualArts = new Category();
		arts.getChildren().add(visualArts);

		visualArts.setParent(arts);
		visualArts.setName("Visual Arts");
		visualArts.setLevel(2);
		visualArts.setDescription("The visual arts are art forms that create works that are primarily visual in nature, such as ceramics, drawing, painting, sculpture, printmaking, design, crafts, photography, video, filmmaking and architecture");
		Category drawing = new Category();
		visualArts.getChildren().add(drawing);
		drawing.setParent(visualArts);
		drawing.setName("Drawing");
		drawing.setLevel(3);
		drawing.setDescription("Drawing is a form of visual art that makes use of any number of drawing instruments to mark a two-dimensional medium.");
		Category painting = new Category();
		visualArts.getChildren().add(painting);
		painting.setParent(visualArts);
		painting.setName("Painting");
		painting.setLevel(3);
		painting.setDescription("Painting is the practice of applying paint, pigment, color or other medium[1] to a surface (support base).");
		Category photography = new Category();
		visualArts.getChildren().add(photography);
		photography.setParent(visualArts);
		photography.setName("Photography");
		photography.setLevel(3);
		photography.setDescription("Photography is the art, science, and practice of creating durable images by recording light or other electromagnetic radiation, either chemically by means of a light-sensitive material such as photographic film, or electronically by means of an image sensor.");
		Category architecture = new Category();
		visualArts.getChildren().add(architecture);
		architecture.setParent(visualArts);
		architecture.setName("Architecture");
		architecture.setLevel(3);
		architecture.setDescription("Architecture is both the process and product of planning, designing, and construction, usually of buildings and other physical structures. ");
		Category ceramics = new Category();
		visualArts.getChildren().add(ceramics);
		ceramics.setParent(visualArts);
		ceramics.setName("Ceramics");
		ceramics.setLevel(3);
		ceramics.setDescription("Ceramics and ceramic art mean art objects such as figures, tiles, and tableware made from clay and other raw materials by the process of pottery.");
		Category sculpture = new Category();
		visualArts.getChildren().add(sculpture);
		sculpture.setParent(visualArts);
		sculpture.setName("Sculpture");
		sculpture.setLevel(3);
		sculpture.setDescription("Sculpture is the branch of the visual arts that operates in three dimensions, and one of the plastic arts. Durable sculptural processes originally used carving (the removal of material) and modelling (the addition of material, as clay), in stone, metal, ceramics, wood and other materials but, since modernism, shifts in sculptural process led to an almost complete freedom of materials and process. A wide variety of materials may be worked by removal such as carving, assembled by welding or modelling, or molded, or cast");
		Category printmaking = new Category();
		visualArts.getChildren().add(printmaking);
		printmaking.setParent(visualArts);
		printmaking.setName("Printmaking");
		printmaking.setLevel(3);
		printmaking.setDescription("Printmaking is the process of making artworks by printing, normally on paper. Printmaking normally covers only the process of creating prints with an element of originality, rather than just being a photographic reproduction of a painting");
		Category design = new Category();
		visualArts.getChildren().add(design);
		design.setParent(visualArts);
		design.setName("Design");
		design.setLevel(3);
		design.setDescription("Design is the creation of a plan or convention for the construction of an object or a system (as in architectural blueprints, engineering drawing, business process, circuit diagrams and sewing patterns).");
		Category crafts = new Category();
		visualArts.getChildren().add(crafts);
		crafts.setParent(visualArts);
		crafts.setName("Crafts");
		crafts.setLevel(3);
		crafts.setDescription("A craft is a pastime or a profession that requires some particular kind of skilled work.");
		Category video = new Category();
		visualArts.getChildren().add(video);
		video.setParent(visualArts);
		video.setName("Video");
		video.setLevel(3);
		video.setDescription("Video is an electronic medium for the recording, copying and broadcasting of moving visual images.");
		Category filmmaking = new Category();
		visualArts.getChildren().add(filmmaking);
		filmmaking.setParent(visualArts);
		filmmaking.setName("Filmmaking");
		filmmaking.setLevel(3);
		filmmaking.setDescription("Filmmaking is the process of making a film. Filmmaking involves a number of discrete stages including an initial story, idea, or commission, through scriptwriting, casting, shooting, editing, and screening the finished product before an audience that may result in a film release and exhibition. ");
		Category computerArt = new Category();
		visualArts.getChildren().add(computerArt);
		computerArt.setParent(visualArts);
		computerArt.setName("Computer Art");
		computerArt.setLevel(3);
		computerArt.setDescription("Computer art is any in which computers played a role in production or display. Such art can be an image, sound, animation, video, CD-ROM, DVD, video game, website, algorithm, performance or gallery installation.");
		
//		Category literaryArts = new Category();
//		literaryArts.setName("Literary Arts");
//		literaryArts.setLevel(2);
//		literaryArts.setDescription("");

		Category performingArts = new Category();
		arts.getChildren().add(performingArts);
		performingArts.setParent(arts);
		performingArts.setName("Performing Arts");
		performingArts.setLevel(2);
		performingArts.setDescription("Performing arts are art forms in which artists use their body or voice to convey artistic expression鈥攁s opposed to visual arts, in which artists use paint/canvas or various materials to create physical art objects");
		Category dance = new Category();
		performingArts.getChildren().add(dance);
		dance.setParent(performingArts);
		dance.setName("Dance");
		dance.setLevel(3);
		dance.setDescription("Dance is a type of art that generally involves movement of the body, often rhythmic and to music. It is performed in many cultures as a form of emotional expression, social interaction, or exercise, in a spiritual or performance setting, and is sometimes used to express ideas or tell a story. Dance may also be regarded as a form of nonverbal communication between humans or other animals, as in bee dances and behaviour patterns such as a mating dances.");
		Category music = new Category();
		performingArts.getChildren().add(music);
		music.setParent(performingArts);
		music.setName("Music");
		music.setLevel(3);
		music.setDescription("Music is an art form whose medium is sound and silence. Its common elements are pitch (which governs melody and harmony), rhythm (and its associated concepts tempo, meter, and articulation), dynamics, and the sonic qualities of timbre and texture.");
		Category opera = new Category();
		performingArts.getChildren().add(opera);
		opera.setParent(performingArts);
		opera.setName("Opera");
		opera.setLevel(3);
		opera.setDescription("Opera is an art form in which singers and musicians perform a dramatic work combining text (called a libretto) and musical score, usually in a theatrical setting.");
		Category theatre = new Category();
		performingArts.getChildren().add(theatre);
		theatre.setParent(performingArts);
		theatre.setName("Theatre");
		theatre.setLevel(3);
		theatre.setDescription("Theatre is a collaborative form of fine art that uses live performers to present the experience of a real or imagined event before a live audience in a specific place.");
		Category magic = new Category();
		performingArts.getChildren().add(magic);
		magic.setParent(performingArts);
		magic.setName("Magic");
		magic.setLevel(3);
		magic.setDescription("Magic (sometimes referred to as stage magic to distinguish it from paranormal or ritual magic) is a performing art that entertains audiences by staging tricks or creating illusions of seemingly impossible or supernatural eats using natural means");
		categoryDao.save(sports);
		categoryDao.save(arts);	
	}
	
	@Transactional
	public void addMore(){
		Category music = categoryDao.findByName("Music");
		Category piano = new Category("Piano");
		piano.setParent(music);
		piano.setDescription("he piano is a musical instrument played using a keyboard. It is widely used in classical and jazz music for solo performances, ensemble use, chamber music and accompaniment and for composing and rehearsal. Although the piano is not portable and often expensive, its versatility and ubiquity have made it one of the world's most familiar musical instruments.");
		music.getChildren().add(piano);
		Category violin = new Category("violin");
		violin.setLevel(4);
		violin.setParent(music);
		violin.setDescription("The violin, also known as a fiddle, is a string instrument, usually with four strings tuned in perfect fifths. It is the smallest, highest-pitched member of the violin family of string instruments, which also includes the viola, the cello and the contrabass.");
		music.getChildren().add(violin);
		Category cello = new Category("Cello");
		cello.setLevel(4);
		cello.setParent(music);
		cello.setDescription("The cello is a bowed string instrument with four strings tuned in perfect fifths.");
		music.getChildren().add(cello);
		Category drum = new Category("Drum");
		drum.setLevel(4);
		drum.setParent(music);
		drum.setDescription("The drum is a member of the percussion group of musical instruments. In the Hornbostel-Sachs classification system, it is a membranophone.[1] Drums consist of at least one membrane, called a drumhead or drum skin, that is stretched over a shell and struck, either directly with the player's hands, or with a drum stick, to produce sound. There is usually a resonance head on the underside of the drum, typically tuned to a slightly lower pitch than the top drumhead. Other techniques have been used to cause drums to make sound, such as the thumb roll. Drums are the world's oldest and most ubiquitous musical instruments, and the basic design has remained virtually unchanged for thousands of years.");
		music.getChildren().add(drum);
		Category guitar = new Category("Guitar");
		guitar.setLevel(4);
		guitar.setParent(music);
		guitar.setDescription("A guitar is a popular musical instrument that makes sound by the playing of its (typically) six strings with the sound being projected either acoustically or through electrical amplification (for an acoustic guitar or an electric guitar, respectively). It is typically played by strumming or plucking the strings with the right hand while fretting the strings with the left hand. The guitar is a type of chordophone, traditionally constructed from wood and strung with either nylon or steel strings and distinguished from other chordophones by its construction and tuning. The modern guitar was preceded by the lute, the vihuela, the four-course Renaissance guitar, and the five-course baroque guitar, all of which contributed to the development of the modern six-string instrument.");
		music.getChildren().add(guitar);
		Category trumpet = new Category("Trumpet");
		trumpet.setLevel(4);
		trumpet.setParent(music);
		trumpet.setDescription("A trumpet is a musical instrument. It is the highest register in the brass family. Trumpets are among the oldest musical instruments,[1] dating back to at least 1500 BC. They are played by blowing air through closed lips, producing a \"buzzing\" sound that starts a standing wave vibration in the air column inside the instrument. Since the late 15th century they have primarily been constructed of brass tubing, usually bent twice into a rounded oblong shape.");
		music.getChildren().add(trumpet);
		Category flute = new Category("Flute");
		flute.setLevel(4);
		flute.setParent(music);
		flute.setDescription("The flute is a musical instrument of the woodwind family. Unlike woodwind instruments with reeds, a flute is an aerophone or reedless wind instrument that produces its sound from the flow of air across an opening. According to the instrument classification of Hornbostel–Sachs, flutes are categorized as edge-blown aerophones.");
		music.getChildren().add(flute);
		Category saxophone = new Category("Saxophone");
		saxophone.setLevel(4);
		saxophone.setParent(music);
		saxophone.setDescription("The saxophone[2] (also referred to as the sax) is a conical-bore woodwind musical instrument. Saxophones are usually made of brass and played with a single-reed mouthpiece similar to that of the clarinet.[2] The saxophone was invented by the Belgian instrument maker Adolphe Sax in 1840.[2][3] Sax wanted to create an instrument that would be the most powerful and vocal of the woodwinds, and the most adaptive of the brass—that would fill the vacant middle ground between the two sections. He patented the saxophone on June 24, 1846, in two groups of seven instruments each. Each series consisted of instruments of various sizes in alternating transposition. The series pitched in B♭ and E♭, designed for military bands, has proved extremely popular and most saxophones encountered today are from this series. Instruments from the so-called \"orchestral\" series, pitched in C and F, never gained a foothold, and the B♭ and E♭ instruments have now replaced the C and F instruments in classical music.");
		music.getChildren().add(saxophone);
		Category guzheng = new Category("Guzheng");
		guzheng.setLevel(4);
		guzheng.setParent(music);
		guzheng.setDescription("The guzheng or gu zheng is a Chinese plucked zither. It has 18 or more strings and movable bridges, and the modern guzheng usually has 21 strings and bridges. The picks (called \"DaiMao\") used by performers to play guzheng are often made out of the shells of Hawksbill.");
		music.getChildren().add(guzheng);
		Category viola = new Category("Viola");
		viola.setLevel(4);
		viola.setParent(music);
		viola.setDescription("The viola is a bowed string instrument. It is slightly larger than a violin in size and has a deeper sound. Since the 18th century it has been the middle voice of the violin family.");
		music.getChildren().add(viola);
		Category doubleBass = new Category("Double Bass");
		doubleBass.setLevel(4);
		doubleBass.setParent(music);
		doubleBass.setDescription("The double bass is the largest and lowest-pitched bowed string instrument of the viol family in the modern symphony orchestra, with strings usually tuned to E1, A1, D2 and G2 (see standard tuning).");
		music.getChildren().add(doubleBass);
		Category erho = new Category("Erhu");
		erho.setLevel(4);
		erho.setParent(music);
		erho.setDescription("The erhu is a two-stringed bowed musical instrument, more specifically a spike fiddle, and sometimes known in the Western world as the \"Chinese violin\" or a \"Chinese two-stringed fiddle\". It is used as a solo instrument as well as in small ensembles and large orchestras. It is the most popular of the huqin family of traditional bowed string instruments used by various ethnic groups of China. A very versatile instrument, the erhu is used in both traditional and contemporary music arrangements, such as in pop, rock, jazz, etc");
		music.getChildren().add(erho);
		categoryDao.update(music);
	}

	@Transactional
	public void update() {
		List<Category> leaves = categoryDao.findAllLeafCategory();
		CategoryPriceCategorization privateCategorization = new CategoryPriceCategorization();
		privateCategorization.setClassType(1);
		privateCategorization.setOneDollarPrice(30);
		privateCategorization.setTwoDollarPrice(45);
		privateCategorization.setThreeDollarPrice(60);
		CategoryPriceCategorization groupCategorization = new CategoryPriceCategorization();
		groupCategorization.setClassType(2);
		groupCategorization.setOneDollarPrice(20);
		groupCategorization.setTwoDollarPrice(30);
		groupCategorization.setThreeDollarPrice(40);
		for(Category category : leaves){
			category.getPriceCategorizations().add(privateCategorization);
			category.getPriceCategorizations().add(groupCategorization);
			categoryDao.update(category);
		}
	}
}
